#include <stdio.h>
#include <stdlib.h>

#define NormalCode 0
#define ErrorCode 1

typedef struct StringNode *Position; /* 指针即结点位置 */
struct StringNode {
    char data; /* 存储数据 */
    Position next; /* 链接存储中下一个元素的位置 */
};
typedef struct StringHeadNode *String;
struct StringHeadNode {
    Position head; /* 字符串头指针，初始化为NULL */
    int length; /* 字符串长度 */
};

String InitStr() {
    /* 初始化一个空的字符串 */
    String s;

    s = (String)malloc(sizeof(struct StringHeadNode));
    s->head = NULL;
    s->length = 0;

    return s;
}

/* 算法4-9：字符串连接操作  StrConcat(s,t) */
void StrConcat(String s, String t) {
    Position p;

    if (s->length > 0) { /* 若s非空串 */
        p = s->head;
        while (p->next != NULL) {
            p = p->next; /* 找到s的最后一个结点 */
        }
        p->next = t->head;
    } else { /* 若s是空串 */
        s->head = t->head;
    }
    s->length += t->length;
}
/* 算法4-9 结束 */

String ReadString() {
    String s;
    Position tail;
    char c;

    s = InitStr(); /* 创建空的字符串 */
    s->head = (Position)malloc(sizeof(struct StringNode));
    tail = s->head; /* 先创建临时空头结点 */
    c = getchar();
    while (c != '\n') {
        tail->next = (Position)malloc(sizeof(struct StringNode));
        tail->next->data = c;
        tail = tail->next;
        s->length++;
        c = getchar();
    }
    tail->next = NULL; /* 链表收尾 */
    tail = s->head;
    s->head = s->head->next;
    free(tail); /* 删除临时空头结点 */
    return s;
}

void PrintString(String s) {
    Position p;

    p = s->head;
    while (p != NULL) {
        printf("%c", p->data);
        p = p->next;
    }
}

int main(void) {
    String s, t;

    s = ReadString();
    t = ReadString();
    StrConcat(s, t);
    PrintString(s);

    return 0;
}